<?php
/**
 * Created by PhpStorm.
 * User: Drunk
 * Date: 2017-1-26
 * Time: 13:47
 */

namespace member\captain;

class admin extends \member\captain{
    public static function check(){
        $info = parent::info();
        return !empty($info['is_admin']);
    }

    public static function info($field = null)
    {
        $dao_users_role = db('UsersRole');
        $info = parent::info();
        $info['id_roles'] = $dao_users_role->where('mid', $info['id'])->column('id_role');
        if (empty($info['id_roles'])) $info['id_roles'] = [];
        return is_null($field) ? $info : $info[$field];
    }
}